﻿@model Wabo.Web.Areas.Manager.ViewModels.Group.GroupListViewModel

@{
    ViewBag.Title = Messages.HeadingGroupList;
}
<div class="page-header">
    <h1>
        @Messages.HeadingGroupList
        @if (Model.CanWrite)
        {
            <a class="btn btn-primary pull-right" href="@Url.Action("Create","Group")">
                <i class=" icon-plus-sign icon-white"></i>@Messages.CreateNewGroup
            </a>            
        }

    </h1>
</div>

<table class="table">
@foreach (var g in Model.Groups)
{
    <tr>
        <td>
            @if (Model.CanWrite)
            {
                @Html.ActionLink(g.name, "Edit", "Group", new {g.id}, null)
            
            }
            else
            {
                @g.name
            }
        </td>
        <td>
            <div class="btn-toolbar pull-right">                
                   
                @if (Model.CanWrite && Model.CanDelete)
                {                     
                    <div class="btn-group">
                        <a class="btn btn-primary btn-mini" href="@Url.Action("Users","Group",new{g.id})">
                            <i class="icon-white icon-user"></i>@Messages.GroupUsersLinkTitle
                        </a>           
                        <a class="btn btn-primary btn-mini" href="@Url.Action("GroupAcl", "Acl", new { g.id })">
                            <i class="icon-white icon-eye-open"></i>@Messages.GroupEditModulePermissionsLink
                        </a>                                    
                    </div>                            
                }
                
                @if (Model.CanDelete)
                {                
                    <div class="btn-group">
                        <a class="btn btn-danger btn-mini" href="@Url.Action("Delete","Group",new{g.id})">
                            <i class="icon-white icon-remove"></i>@Messages.ButtonDelete
                        </a>   
                    </div>                            
                }

            </div>
            
        </td>

    </tr> 
}
</table>